#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cstring>
using namespace std;

class Solution{
    public:
    void ans1(vector<vector<int>>& matrix){
        int rows = matrix.size();
        int cols = matrix[0].size();
        vector<int> row;
        vector<int> col;
        for(int i = 0; i != rows; i++){
            for(int j = 0; j != cols; j++){
                if(matrix[i][j] == 0){
                    row.push_back(i);
                    col.push_back(j);
                }
            }
        }
        int len = row.size();
        for(int k = 0; k != len; k++){
            for(int i = 0; i != rows; i++){
                matrix[i][col[k]] = 0;
            }
            for(int j = 0; j != cols; j++){
                matrix[row[k]][j] = 0;
            }
        }
        
    }

    void show(vector<vector<int>>& num){
        int rows = num.size();
        int cols = num[0].size();
        for(int i = 0; i != rows; i++){
            for(int j = 0; j != cols-1; j++){
                cout << num[i][j] << " " << ends;
            }
            cout << num[i][cols-1] << endl;
        }
    }
};

void test1(){
    Solution s;
    vector<vector<int>> val = {
        {0,1,2,0},
        {3,4,5,2},
        {1,3,1,5},
    };
    s.ans1(val);
    s.show(val);
}

int main(void){
    test1();

    return 0;
}